package com.ruoyi.order.service.impl;

import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.order.mapper.TbOrderDetailMapper;
import com.ruoyi.order.domain.TbOrderDetail;
import com.ruoyi.order.service.ITbOrderDetailService;

/**
 * 订单明细Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-08-02
 */
@Service
public class TbOrderDetailServiceImpl implements ITbOrderDetailService 
{
    @Autowired
    private TbOrderDetailMapper tbOrderDetailMapper;

    /**
     * 查询订单明细
     * 
     * @param detailId 订单明细主键
     * @return 订单明细
     */
    @Override
    public TbOrderDetail selectTbOrderDetailByDetailId(Integer detailId)
    {
        return tbOrderDetailMapper.selectTbOrderDetailByDetailId(detailId);
    }

    /**
     * 查询订单明细列表
     * 
     * @param tbOrderDetail 订单明细
     * @return 订单明细
     */
    @Override
    public List<TbOrderDetail> selectTbOrderDetailList(TbOrderDetail tbOrderDetail)
    {
        return tbOrderDetailMapper.selectTbOrderDetailList(tbOrderDetail);
    }

    /**
     * 新增订单明细
     * 
     * @param tbOrderDetail 订单明细
     * @return 结果
     */
    @Override
    public int insertTbOrderDetail(TbOrderDetail tbOrderDetail)
    {
        tbOrderDetail.setCreateTime(DateUtils.getNowDate());
        return tbOrderDetailMapper.insertTbOrderDetail(tbOrderDetail);
    }

    /**
     * 修改订单明细
     * 
     * @param tbOrderDetail 订单明细
     * @return 结果
     */
    @Override
    public int updateTbOrderDetail(TbOrderDetail tbOrderDetail)
    {
        tbOrderDetail.setUpdateTime(DateUtils.getNowDate());
        return tbOrderDetailMapper.updateTbOrderDetail(tbOrderDetail);
    }

    /**
     * 批量删除订单明细
     * 
     * @param detailIds 需要删除的订单明细主键
     * @return 结果
     */
    @Override
    public int deleteTbOrderDetailByDetailIds(Integer[] detailIds)
    {
        return tbOrderDetailMapper.deleteTbOrderDetailByDetailIds(detailIds);
    }

    /**
     * 删除订单明细信息
     * 
     * @param detailId 订单明细主键
     * @return 结果
     */
    @Override
    public int deleteTbOrderDetailByDetailId(Integer detailId)
    {
        return tbOrderDetailMapper.deleteTbOrderDetailByDetailId(detailId);
    }
}
